function debounce(func:() => void, wait:number) {
    let timeout: NodeJS.Timeout;
    return function () {

        if (timeout) clearTimeout(timeout);
        
        timeout = setTimeout(() => {
            func()
        }, wait);
    }
}

export default debounce